package com.kuang.auto_proxy_2;

import com.kuang.demo2.UserService;
import com.kuang.demo2.UserServiceImpl;

public class Client {
    public static void main(String[] args) {
        //真实角色
        UserServiceImpl userService = new UserServiceImpl();
        //代理角色，不存在
        ProxyInvocationHadler pih = new ProxyInvocationHadler();
        pih.setTarget(userService);

        //设置要代理的对象
        //动态生成代理类
        UserService proxy = (UserService) pih.getProxy();

        proxy.add();
        proxy.delete();
        proxy.update();
        proxy.query();
    }

}
